#include <bits/stdc++.h>
using namespace std;


typedef pair<int, int> pii;

int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int T;
    while(cin >> T && T){
        //if(T %2 == 1) {cout << "NO\n"; continue;}
        multiset<pii> s;
        for (int i = 0; i < T; ++i) {
            int a, b; cin >> a >> b;
            pii t = make_pair(a, b);
            pii r = make_pair(b, a);
            if(s.count(r)){
                s.erase(s.find(r));
            }
            else s.insert(t);
        }
        if(s.empty()) cout << "YES\n";
        else cout << "NO\n";

    }
    return 0;
}